VIMS2::Application.routes.draw do
  
  
  get ":idOrden/det_ordenes_compra" => "det_ordenes_compra#index", :as => "det_ordenes_compra"
  get "orden/:idOrden/det_orden_compra/:idDet" => "det_ordenes_compra#show", :as => "mostrar_det_orden_compra"
  post ":idOrden/det_ordenes_compra" => "det_ordenes_compra#create", :as => "det_ordenes_compra"
  get "orden/:idOrden/det_ordenes_compra/:idDet" => "det_ordenes_compra#edit", :as => "editar_det_orden_compra"
  
  resources :det_ordenes_compra
  
  resources :ordenes_compra


  resources :destinos


  resources :items


  resources :receiving_tickets
  post "receiving_tickets/cliente_rt/:accion" => "receiving_tickets#cliente_rt", :as => "cliente_rt"
  get "receiving_tickets/seleccionar_cliente/:accion" => "receiving_tickets#seleccionar_cliente" ,  :as => "seleccionar_cliente" 
  get "proveedores/agregar_proveedor" => "receiving_tickets#agregar_proveedor" , :as=>"agregar_proveedor"
  

  resources :pantallas
    #Agrega TODAS las vistas del sistema a la BD (solo se debe correr UNA vez ya que al hacerlo de nuevo
  # se eliminan todas las que estaban y se vuelven a crear y se debe hacer de nuevo la configuracion del
  # nombre por cada vista)
  get "perfiles/administracion_vistas" => "perfiles#administracion_vistas" ,  :as => "admin_vistas"
  post "pantallas_sistema" => "perfiles#pantallas_sistema" , :as => "pantallas_sistema"
  
  #Se le asigna un Nombre a cada vista que es el que se le mostrara al administrador del sistema a la hora
  # de asignar permisos a un perfil
  get "perfiles/configuracion_pantallas" => "perfiles#configuracion_pantallas", :as => "config_pantallas" 
  post "perfiles/nombres_pantallas" => "perfiles#nombres_pantallas", :as => "nombres_pantallas"
  
  #Al iniciar sesion si el usuario tiene mas de un perfil debe seleccionar uno
  get "perfiles_usuario" => "perfiles#perfiles_usuario" , :as => "perfiles_usuario"
  post "perfiles/seleccion_perfil" => "perfiles#seleccion_perfil", :as => "seleccion_perfil"
  
  # Asigna permisos por pantalla a un perfil
  get "perfiles/:idPerfil/asignar_pantallas" => "perfiles#asignar_pantallas" , :as => "asignar_pantallas"
  post "perfiles/:idPerfil/pantallas_perfil" => "perfiles#pantallas_perfil" ,  :as => "pantallas_perfil"


   resources :paises


  resources :unidades_medida


  resources :conceptos_cobro


  resources :transportistas

  
  resources :proveedores


  resources :clientes
  get '/clientes/:idCliente/asignar_transportistas' => 'clientes#asignar_transportistas', :as => "asignar_transportistas"
  post '/clientes/:idCliente/agregar_transportistas' => 'clientes#agregar_transportistas', :as => "agregar_transportistas"

  get '/clientes/:idCliente/asignar_proveedores' => 'clientes#asignar_proveedores', :as => "asignar_proveedores"
  post '/clientes/:idCliente/agregar_proveedores' => 'clientes#agregar_proveedores', :as => "agregar_proveedores"

  get '/clientes/:idCliente/asignar_items' => 'clientes#asignar_items', :as => "asignar_items"
  post '/clientes/:idCliente/agregar_items' => 'clientes#agregar_items', :as => "agregar_items"
  
  get "inicio" => "inicio#index", :as => :inicio

  resources :sessions, :only => [:new, :create, :destroy]
  match 'login' => "sessions#new",      :as => :login
  match 'logout' => "sessions#destroy", :as => :logout

  resources :perfiles

  resources :usuarios

  resources :empleados


  root :to => "inicio#index"
  # The priority is based upon order of creation:
  # first created -> highest priority.

  # Sample of regular route:
  #   match 'products/:id' => 'catalog#view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Sample resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Sample resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Sample resource route with more complex sub-resources
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', :on => :collection
  #     end
  #   end

  # Sample resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end

  # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  # root :to => 'welcome#index'

  # See how all your routes lay out with "rake routes"

  # This is a legacy wild controller route that's not recommended for RESTful applications.
  # Note: This route will make all actions in every controller accessible via GET requests.
  # match ':controller(/:action(/:id))(.:format)'
  # The priority is based upon order of creation:
  # first created -> highest priority.

  # Sample of regular route:
  #   match 'products/:id' => 'catalog#view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Sample resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Sample resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Sample resource route with more complex sub-resources
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', :on => :collection
  #     end
  #   end

  # Sample resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end

  # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  # root :to => 'welcome#index'

  # See how all your routes lay out with "rake routes"

  # This is a legacy wild controller route that's not recommended for RESTful applications.
  # Note: This route will make all actions in every controller accessible via GET requests.
  # match ':controller(/:action(/:id))(.:format)'
end
